class Human:
    def __init__(self, name, gender, age, phone_balance, phone_brand, battery_capacity, screen_size, max_standby_time, points):
        self.name = name
        self.gender = gender
        self.age = age
        self.phone_balance = phone_balance
        self.phone_brand = phone_brand
        self.battery_capacity = battery_capacity
        self.screen_size = screen_size
        self.max_standby_time = max_standby_time
        self.points = points

    def send_sms(self,message):
        print(f"{self.name}发送短信:{message}")

    def make_call(self,phone_number,duration):
        # 验证手机号有效性
        if not phone_number:
            print("拨号失败：手机号码为空")
            return {"status": "error", "message": "手机号码为空"}

        # 验证话费余额
        if self.phone_balance < 1:
            print(f"拨号失败：话费余额不足 (当前余额: {self.phone_balance}元)")
            return {"status": "error", "message": "话费余额不足"}

        # 计算通话费用和积分
        rate = self._calculate_call_rate(duration)
        point_rate = self._calculate_point_rate(duration)

        call_cost = round(rate * duration, 2)
        points_earned = point_rate * duration

        # 检查余额是否足够支付通话
        if call_cost > self.phone_balance:
            print(f"拨号失败：话费不足，需要支付{call_cost}元 (当前余额: {self.phone_balance}元)")
            return {"status": "error", "message": "话费不足"}

        # 执行通话和扣费
        self.phone_balance -= call_cost
        self.points += points_earned

        # 显示通话详情
        print(f"{self.name}使用{self.phone_brand}拨打{phone_number} {duration}分钟...")
        print(f"通话扣费: {call_cost}元 (当前余额: {self.phone_balance}元)")
        print(f"获得积分: {points_earned}分 (当前积分: {self.points})")

        return {
            "status": "success",
            "cost": call_cost,
            "points_earned": points_earned,
            "balance": self.phone_balance,
            "points": self.points
        }

    def _calculate_call_rate(self, duration):
        """计算通话费率"""
        if duration <= 10:
            return 1.0
        elif duration <= 20:
            return 0.8
        else:
            return 0.65

    def _calculate_point_rate(self, duration):
        """计算积分获取率"""
        if duration <= 10:
            return 15
        elif duration <= 20:
            return 39
        else:
            return 48

    def __str__(self):
        """返回人类对象的字符串表示"""
        return (f"{self.name}({self.age}岁, {self.gender}), 使用{self.phone_brand}手机\n"
                f"话费余额: ¥{self.phone_balance:.2f} | 积分: {self.points}分\n"
                f"电池容量: {self.battery_capacity}mAh | 屏幕尺寸: {self.screen_size}英寸 | "
                f"待机时长: {self.max_standby_time}小时")

        # 创建几个不同的人

person1 = Human(
        name="张三",
        gender="男",
        age=28,
        phone_balance=50.00,
        phone_brand="iPhone 15 Pro",
        battery_capacity=3274,
        screen_size=6.1,
        max_standby_time=100,
        points=500
    )

person2 = Human(
        name="李梅",
        gender="女",
        age=32,
        phone_balance=35.50,
        phone_brand="华为 Mate 60",
        battery_capacity=5000,
        screen_size=6.8,
        max_standby_time=150,
        points=220
    )

person3 = Human(
        name="王小虎",
        gender="男",
        age=18,
        phone_balance=0.80,
        phone_brand="小米 13",
        battery_capacity=4500,
        screen_size=6.7,
        max_standby_time=120,
        points=0
    )

    # 显示人员信息
print("=== 人员信息 ===")
print(person1)
print("\n" + "-" * 40)
print(person2)
print("\n" + "-" * 40)
print(person3)
print("\n")

    # 测试功能
print("=== 短信功能测试 ===")
person1.send_sms("你好，今晚7点我们在老地方见！")
person2.send_sms("会议时间改为明天上午10点")

print("\n=== 通话功能测试 ===")
print("场景1: 正常通话 (8分钟)")
result1 = person1.make_call("13800138000", 8)

print("\n场景2: 正常通话 (15分钟)")
result2 = person2.make_call("13912345678", 15)

print("\n场景3: 空号码测试")
person3.make_call("", 5)

print("\n场景4: 低余额测试 (0.8元余额)")
person3.make_call("13600001111", 2)

print("\n场景5: 超长通话 (30分钟)")
result3 = person1.make_call("13799991111", 30)